#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int m, s, t;
int dt[245][25];
int fastest(int m, int s) {
  rep(i, 0, 19) dt[0][i] = 0;
  rep(i, 1, 240) {
    per(j, 19, 0) {
      if (j >= 10) {
        if (i >= 60)
          dt[i][j] = 1 + dt[i - 60][j - 10];
        else
          dt[i][j] = 1;
      } else {
        if (i >= 17)
          dt[i][j] = 1 + min(dt[i - 17][j], dt[i][j + 4]);
        else
          dt[i][j] = 1;
      }
    }
  }
  int t0 = m / 10;
  if (t0 * 60 >= s) return (s + 59) / 60;
  s -= t0 * 60;
  m %= 10;
  if (s <= 240)
    return t0 + dt[s][m];
  else {
    int s1 = s % 120 + 120;
    int s2 = s - s1;
    return t0 + s2 / 120 * 7 + dt[s1][m];
  }
}
int ds[25][25];
int farthest(int m, int t) {
  rep(i, 0, 19) ds[0][i] = 0;
  rep(i, 1, 14) {
    rep(j, 0, 19) {
      if (j >= 10)
        ds[i][j] = 60 + ds[i - 1][j - 10];
      else
        ds[i][j] = max(17 + ds[i - 1][j], ds[i - 1][j + 4]);
    }
  }
  int t0 = m / 10;
  if (t0 >= t) return t * 60;
  int s0 = t0 * 60;
  t -= t0;
  m %= 10;
  if (t <= 14)
    return s0 + ds[t][m];
  else {
    int t1 = t % 7 + 7;
    int t2 = t - t1;
    return s0 + t2 / 7 * 120 + ds[t1][m];
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> m >> s >> t;
  int tmn = fastest(m, s);
  if (tmn <= t) {
    cout << "Yes\n" << tmn;
  } else {
    cout << "No\n";
    cout << farthest(m, t);
  }
  return 0;
}